<?php
/* @var $this QshiftController */
/* @var $model Qshift */

$this->breadcrumbs=array(
	'Management'=>array('/site/management/'),
	'Maintenance'=>array('/site/maintenance/'),	
	'Q-Shifts',
);

$this->menu=array(
	//array('label'=>'List Qshift', 'url'=>array('index')),
	array('label'=>'Create Qshift', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#qshift-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Manage Qshifts</h1>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>


<p><b>
<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
</b></p>

<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'qshift-grid',
	'dataProvider'=>(!(Yii::app()->user->restricted))? $model->search(): $model->search(Yii::app()->user->team_id),
	'filter'=>$model,
	'columns'=>array(
		/*array(
			'name'=>'idqshift',
			'header'=>'Id#',
			'value'=>'$data->idqshift',
			'htmlOptions' => array(
								'style' => 'width: 40px; text-align: center;',
							 ),
		),	*/		
		array(
			'name'=>'name',
			'header'=>'Name',
			'value'=>'$data->name',
			'htmlOptions' => array(
								'style' => 'text-align: center;',
							 ),
		),	
		array(
			'name'=>'description',
			'header'=>'Description',
			'value'=>'$data->description',
			'htmlOptions' => array(
								'style' => 'text-align:center;',
							 ),
		),	
		array(
			'name'=>'start_time',
			'header'=>'Start Time',
			'value'=>'$data->start_time',
			'htmlOptions' => array(
								'style' => 'width:80px;text-align:center;',
							 ),
		),			
		array(
			'name'=>'end_time',
			'header'=>'End Time',
			'value'=>'$data->end_time',
			'htmlOptions' => array(
								'style' => 'width:80px;text-align:center;',
							 ),
		),
		array(
			'name'=>'enabled',
			'header'=>'Enabled',
			'value'=> 'User::getYesNoValue($data->enabled)',
			'filter' => array('0'=>'No', '1'=>'Yes'),
			'htmlOptions' => array(
								'style' => 'width:20px;text-align:center;',
							 ),
		),
		/*
		'availability',
		'swap_allowed',
		*/
		array(
			'name'=>'team_id',
			'header'=>'Team',
			'value'=>'$data->team_relation->short_name;',
			'filter'=>CHtml::listData(Team::model()->findAll(array('order'=>'short_name ASC')),
																		 'idteam',
																		 'short_name'
																		 ),
			'htmlOptions' => array(
								'style' => 'width:90px; text-align: center;',
							 ),			
		),			
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>
